#ifndef __LM_MEDIA_STREAMH__
#define __LM_MEDIA_STREAMH__

#include "lm_base.h"
#include "lm_avnet_base.h"
#include "lm_device_info.h"
#include "lmCommon.h"


using namespace std;


class lmRtpStream;
class lmPsStream;
class lmGb28Client;
class lmNet;
class lmStreamBase
{
	public:
		lmStreamBase();
		virtual ~lmStreamBase();
		
	public:
		virtual int get_stream(Frame_st *&pFrame) = 0;
		virtual int get_stream_size() = 0;
		virtual int send_stream(void *args) = 0;

	public:
		lmRtpStream  *m_rtp;
		lmPsStream   *m_ps;
		lmGb28Client *gbClient;
		media_ctrl_st *m_mctl;
		uint   m_frameRate;
		
	public:
		int lm_start_media_session();
		int lmStreamInit(void *pThis,    media_para_st *p_mp);
	    int lm_pack_send_stream(Frame_st *pFrame);
		int calac_pts(uint pFrameRate);

	private:
		int lm_pack_send_stream_by_rtpPs(Frame_st *pFrame);
		int lm_pack_send_stream_by_rtp(Frame_st *pFrame);

		int lm_pack_send_stream_by_rtp_ps_head(uint payload,uint pts, uchar streamId, uchar frameType);
		int lm_pack_send_stream_by_rtp_pes(char *rtpHead, int rtpHeadLen, char *srcData, int srcLen, uint payload,uint pts, uchar streamId);

	private:
		media_para_st g_mPara0;
		lmNet      *MediaNet;

		uint m_pocketNum; 
};

class lmLiveStream : public lmStreamBase
{
	public:
		lmLiveStream(liveplayCB play);
		~lmLiveStream();
		
	public:
		virtual int get_stream(Frame_st *&pFrame);
		virtual int get_stream_size();
		virtual int send_stream(void *args);

	private:
		liveplayCB liveStreamCallFun;
};

class lmPlaybackStream : public lmStreamBase
{
	public:
		lmPlaybackStream(playbackCB playback);
		~lmPlaybackStream();
		
	public:
		virtual int get_stream(Frame_st *&pFrame);
		virtual int get_stream_size();
		virtual int send_stream(void *args);

	private:
	    playbackCB playbackStreamCallFun;
};

class lmFileDownStream : public lmStreamBase
{
	public:
		lmFileDownStream(filedownCB filedown);
		~lmFileDownStream();
		
	public:
		virtual int get_stream(Frame_st *&pFrame);
		virtual int get_stream_size();
		virtual int send_stream(void *args);

	private:
		filedownCB filedownStreamCallFun;
};


#endif
